load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "memoryusagealarm",
    srcs = ["memoryusagealarm.go"],
    importpath = "github.com/pingcap/tidb/util/memoryusagealarm",
    visibility = ["//visibility:public"],
    deps = [
        "//config",
        "//sessionctx/variable",
        "//util",
        "//util/disk",
        "//util/logutil",
        "//util/memory",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "memoryusagealarm_test",
    timeout = "short",
    srcs = ["memoryusagealarm_test.go"],
    embed = [":memoryusagealarm"],
    flaky = True,
    race = "on",
    deps = [
        "//sessionctx/stmtctx",
        "//sessionctx/variable",
        "//util",
        "//util/memory",
        "@com_github_stretchr_testify//assert",
    ],
)
